$().ready(function() {
	var havetowrite = $('#havetowrite').text();
	var minlen = $('#minlen').text();
	var maxlen = $('#maxlen').text();
	var entervalidemail = $('#entervalidemail').text();
	// alert(havetowrite);
	$("#addOrder").validate({
		rules : {
			'order.NAME' : {
				required : true,
				minlength : 3,
				maxlength : 40
			},
			'order.EMAIL' : {
				required : true,
				email : true,
				maxlength : 40
			},
			'order.MESSAGE' : {
				required : true,
				minlength : 3,
				maxlength : 300,
			},
			'order.PHONE' : {
				maxlength : 40,
			}
		},
		messages : {
			'order.NAME' : {
				required : havetowrite,
				minlength : minlen,
				mxnlength : maxlen
			},
			'order.EMAIL' : {
				required : havetowrite,
				minlength : minlen,
				maxlength : maxlen,
				email: entervalidemail
			},
			'order.MESSAGE' : {
				required : havetowrite,
				minlength : minlen,
				maxlength : maxlen
			},
			'order.PHONE' : maxlen
		}
	});
});